#!/bin/bash
if [ $# -lt 6 ];then
echo "Usage: $0 <threads> <querys> <user> <password> <host> <port>"
exit 1
fi
i=0  
THREADS=$1
QUERYS=$2
USER=$3
PASS=$4
HOST=$5
PORT=$6
  
SQL0="mysqlslap -u$USER -p$PASS --host=$HOST --auto-generate-sql --concurrency=$THREADS --number-of-queries=$QUERYS   --number-char-cols=1 --port=$PORT" 
SQL1="mysqlslap -u$USER -p$PASS --host=$HOST --auto-generate-sql --concurrency=$THREADS --number-of-queries=$QUERYS   --number-char-cols=1 --port=$PORT" # 不加载任何模块, 不会挂掉
SQL2="mysqlslap -u$USER -p$PASS --host=$HOST --auto-generate-sql --concurrency=$THREADS --number-of-queries=$QUERYS   --number-char-cols=1 --port=$PORT" # 加载normalize模块, 不会挂掉
SQL3="mysqlslap -u$USER -p$PASS --host=$HOST --auto-generate-sql --concurrency=$THREADS --number-of-queries=$QUERYS   --number-char-cols=1 --port=$PORT" # 加载normalize + lktencrypt模块, 会挂掉
SQL4="mysqlslap -u$USER -p$PASS --host=$HOST --concurrency=$THREADS --number-of-queries=$QUERYS --create-schema=\"testdb\" --query=\"INSERT INTO t1 VALUES (NULL,'guojianchuan,helloworld,hangzhou');\" --port=$PORT"
SQL=$SQL3
while [ $i -lt 100 ]  
do  
    i=$(($i+1));  
    echo "count :" $i 
    echo $SQL
    $SQL
    if [ $? -ne 0 ];then
        echo "error"
        exit
    fi
done  

